<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>添加/编辑团购 - Powered By ${systemConfig.systemName}</title>
<meta name="Author" content="webmall Team" />
<meta name="Copyright" content="webmall" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<#include "/WEB-INF/template/common/include.ftl">
<link href="${base}/template/admin/css/input.css" rel="stylesheet" type="text/css" />
<#if !id??>
	<#assign isAdd = true />
<#else>
	<#assign isEdit = true />
</#if>

<script type="text/javascript">
	
</script>
</head>
<body class="input">
	<div class="body">
		<div class="inputBar">
			<h1><span class="icon">&nbsp;</span><#if isAdd??>添加团购<#else>编辑团购</#if></h1>
		</div>
		<div class="inputBar" style="padding-left:10px;margin-bottom:10px;">
			<form action="javascript:searchProduct();" name="searchForm">
			    <!-- 分类 -->
			   商品搜索：分类：<select name="sproductCategory" id="sproductCategory" class="{required: true}">
					<option value="">请选择...</option>
					<#list productCategoryTreeList as list>
						<option value="${list.id}"<#if (list.id == product.productCategory.id)!> selected</#if>>
							<#if list.level != 0>
								<#list 1..list.level as i>------</#list>
							</#if>
							${list.name}
						</option>
					</#list>
				</select>
			    <!-- 品牌 -->
			    品牌：
			    <select name="sbrand" id="sbrand">
					<option value="">请选择...</option>
					<#list allBrand as list>
						<option value="${list.id}"<#if (list.id == product.brand.id)!> selected </#if>>
							${list.name}
						</option>
					</#list>
				</select>
			    <!-- 关键字 -->
			    名称：
			    <input type="text" name="skeyword" size="20" id="skeyword">
			    <input type="button" value=" 搜索 " class="button" onclick="searchProduct();">
			</form>
		</div>
		<form id="inputForm" class="validate" action="<#if isAdd??>groupbuy!save.action<#else>groupbuy!update.action</#if>" method="post">
			<input type="hidden" name="id" value="${id}" />
			<table class="inputTable">
				<tr>
					<th>
						团购产品:
					</th>
					<td>
						<select id="product" name="groupbuy.product.id" class="formText {required: true}">
							<#if (groupbuy != null && groupbuy.product != null)>
								<option value="${groupbuy.product.id}">${groupbuy.product.name}</option>
							<#else>
								<option value="">请选择...</option>
							</#if>
							
						</select>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						团购名称:
					</th>
					<td>
						<input type="text" name="groupbuy.name" class="formText {required: true}" value="${(groupbuy.name)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						团购描述:
					</th>
					<td>
						<textarea name="groupbuy.desc" class="formTextarea {required: true}" rows="30" cols="100">${(groupbuy.desc)!}</textarea>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						开始时间:
					</th>
					<td>
						<input type="text" id="startTime" name="groupbuy.startTime" onclick="WdatePicker({el:'startTime',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,isShowClear:false});" class="formText {required: true}" value="${(groupbuy.startTime)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						结束时间:
					</th>
					<td>
						<input type="text" id="endTime" name="groupbuy.endTime" onclick="WdatePicker({el:'endTime',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true,isShowClear:false});" class="formText {required: true}" value="${(groupbuy.endTime)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						价格:
					</th>
					<td>
						<input type="text" id="price" name="groupbuy.price"  class="formText {required: true}" value="${(groupbuy.price)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						最大数量:
					</th>
					<td>
						<input type="text" id="buycount" name="groupbuy.buycount"  class="formText {required: true}" value="${(groupbuy.buycount)!}" />
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						地区:
					</th>
					<td>
						<input type="text" name="groupbuy.areaPath" class="areaSelect hidden {required: true, messages: {required: '请选择地区！'}, messagePosition: '#addressMessagePosition'}" value="${(groupbuy.areaPath)!}" />
						<span id="addressMessagePosition"></span>
					</td>
				</tr>
				<tr>
					<th>
						团购状态:
					</th>
					<td>
						<select name="groupbuy.state" id="state" class="formText {required: true}">
							<option value="">请选择</option>
							<option value="1" <#if (groupbuy.state == 1)!> selected</#if>>发布</option>
							<option value="0" <#if (groupbuy.state == 0)!> selected</#if>>取消</option>
						</select>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						团购类型:
					</th>
					<td>
						<select name="groupbuy.type" id="type" class="formText {required: true}">
							<option value="">请选择</option>
							<option value="1" <#if (groupbuy.type == 1)!> selected</#if>>商品团购</option>
							<option value="2" <#if (groupbuy.type == 2)!> selected</#if>>酒店团购</option>
							<option value="3" <#if (groupbuy.type == 3)!> selected</#if>>其他团购</option>
						</select>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						团购类别:
					</th>
					<td>
						<select name="groupbuy.category" id="category" class="formText {required: true}">
							<option value="">请选择</option>
							<option value="1" <#if (groupbuy.category == 1)!> selected</#if>>餐饮美食</option>
							<option value="2" <#if (groupbuy.category == 2)!> selected</#if>>娱乐休闲</option>
							<option value="3" <#if (groupbuy.category == 3)!> selected</#if>>生活服务</option>
							<option value="4" <#if (groupbuy.category == 4)!> selected</#if>>生鲜果蔬 </option>
							<option value="5" <#if (groupbuy.category == 5)!> selected</#if>>其他 </option>
						</select>
						<label class="requireField">*</label>
					</td>
				</tr>
				<tr>
					<th>
						是否推荐团购:
					</th>
					<td>
						<label><input type="radio" name="groupbuy.recommend" value="true"<#if (groupbuy.recommend == true)!> checked</#if> />是</label>
						<label><input type="radio" name="groupbuy.recommend" value="false"<#if (isAdd || groupbuy.recommend == false)!> checked</#if> />否</label>
					</td>
				</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="确  定" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
		</form>
	</div>
	
	<script type="text/javascript">
		var $areaSelect = $(".areaSelect");

		// 地区选择菜单
		$areaSelect.lSelect({
			url: "area!ajaxChildrenArea.action"// AJAX数据获取url
		});
	</script>
</body>
</html>